/**
 * 
 */
package org.json.simple;

import java.io.IOException;
import java.io.Writer;

/**
 * Beans that support customized output of JSON text should implement this interface.
 * 
 * @author Roger Xu<roger.xu.2007@gmail.com>
 */
public interface JSONAware {

    /**
     * Get JSON text.
     * 
     * @return JSON text
     */
    String toJSONString();

    /**
     * Get JSON text.
     * 
     * @param isPretty
     *            true if output in a pretty style format
     * @return JSON text
     */
    String toJSONString(final boolean isPretty);

    /**
     * Get JSON text and write it to out.
     * 
     * @param out
     *            The Writer object.
     * @param isPretty
     *            true if output in a pretty style format
     */
    void writeJSONString(final Writer out, final boolean isPretty) throws IOException;
}
